﻿using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using LTJ.Common;
using LTJ.Entity;
using LTJ.FrameWork;

namespace LTJ.Web.UI.datacontrol
{
    /// <summary>
    /// 港口列表
    /// </summary>
    public class ajaxcorpportlist : BaseWebControl
    {
        protected string search_txt_name = SASRequest.GetString("search_txt_name").Trim();
        protected string search_txt_ename = SASRequest.GetString("search_txt_ename").Trim();
        protected string routestr = SASRequest.GetString("routestr").Trim();
        private string strWhere = "";

        public override void ShowUserControl()
        {
            SetBaseDataVar();
            RowsCount = BaseDatas.GetBaseDataCount(strWhere);
            dataDT = BaseDatas.GetBaseDataByPage(PageIndex, PageSize, strWhere, "");
            GetPageList("search_txt_ename=" + search_txt_ename + "&search_txt_name=" + search_txt_name + "&routestr=" + routestr);
        }

        /// <summary>
        /// 设置基本参数获取变量
        /// </summary>
        /// <returns></returns>
        private void SetBaseDataVar()
        {
            if (controllername == "ajaxcorpportlist.ascx" || controllername == "ajaxcorpportlist_list.ascx")
            {
                showdiv = "ajaxcorpportdatalist";
                if (routestr == "") strWhere = "1=2";
                else strWhere = BaseDatas.GetPortDataWhere(search_txt_name, search_txt_ename, routestr);
            }
            else if (controllername == "ajaxloadportlist.ascx" || controllername == "ajaxloadportlist_list.ascx")
            {
                showdiv = "ajaxloadportdatalist";
                strWhere = BaseDatas.GetLoadPortDataWhere(search_txt_name, search_txt_ename);
            }
            else if (controllername == "ajaxtranportlist.ascx" || controllername == "ajaxtranportlist_list.ascx")
            {
                showdiv = "ajaxtranportdatalist";
                strWhere = BaseDatas.GetTranPortDataWhere(search_txt_name, search_txt_ename);
            }
            else if (controllername == "ajaxdocklist.ascx" || controllername == "ajaxdocklist_list.ascx")
            {
                showdiv = "ajaxdockdatalist";
                strWhere = BaseDatas.GetDockDataWhere(search_txt_name, search_txt_ename);
            }
            else if (controllername == "ajaxcarrierlist.ascx" || controllername == "ajaxcarrierlist_list.ascx")
            {
                showdiv = "ajaxcarrierlist";
                strWhere = BaseDatas.GetCarrDataWhere(search_txt_name, search_txt_ename);
            }
            else if (controllername == "ajaxroutelinelist.ascx" || controllername == "ajaxroutelinelist_list.ascx")
            {
                showdiv = "ajaxroutelinedatalist";
                strWhere = BaseDatas.GetSeaRouteDataWhere(search_txt_name, search_txt_ename);
            }
            else if (controllername == "ajaxselfcarrierlist.ascx" || controllername == "ajaxselfcarrierlist_list.ascx")
            {
                showdiv = "ajaxroutecarrierdatalist";
                strWhere = BaseDatas.GetCarrDataWhere(search_txt_name, search_txt_ename);
            }
            else if (controllername == "ajaxselfroutelinelist.ascx" || controllername == "ajaxselfroutelinelist_list.ascx")
            {
                showdiv = "ajaxcorproutedatalist";
                strWhere = BaseDatas.GetSeaRouteDataWhere(search_txt_name, search_txt_ename, routestr, compid);
            }
            else if (controllername == "ajaxcountrylist.ascx" || controllername == "ajaxcountrylist_list.ascx")
            {
                showdiv = "ajaxcountrydata";
                strWhere = BaseDatas.GetCountryDataWhere(search_txt_name, search_txt_ename);
            }
            else if (controllername == "ajaxallportlist.ascx" || controllername == "ajaxallportlist_list.ascx")
            {
                showdiv = "ajaxallportdata";
                strWhere = BaseDatas.GetPortDataWhere(search_txt_name, search_txt_ename, routestr);
            }
        }
    }
}
